#ifndef BASE_TASK_HPP   
#define BASE_TASK_HPP

#include <base/log.h>
#include <util/string.h>
#include <functional>
#include <unistd.h>
#include <string>
#include <vector>

class Task {
    public:
        Task() = default;
        Task(int fd)
            :fd_(fd)
        {}
        virtual ~Task() = default;
        virtual int GetFd() const { return fd_; }
        bool SetNonBlock();
        virtual void TaskHandler() = 0;
    protected:
        int fd_ = -1;
};


class ReadTask : public Task {
    public:
        ReadTask(int fd, int epollfd)
            :Task(fd), epollfd_(epollfd)
        {}
        virtual void TaskHandler() override;
        virtual ~ReadTask() = default;
    protected:
        int epollfd_;
};

class SolveTask : public Task {
    public:
        SolveTask(std::string &message)
            :message_(std::move(message))
        {}
        virtual void TaskHandler() override;
        virtual ~SolveTask() = default;
    protected:
        std::string message_;
};


#endif